<?xml version="1.0" encoding="UTF-8"?>
<dxl:DXLMessage xmlns:dxl="http://greenplum.com/dxl/2010/12/">
  <dxl:Comment><![CDATA[
    Objective: Basic check that ORCA generates a plan for a query with ordered aggregates and grouping columns in the direct args.

    EXPLAIN
    SELECT a, rank(a) WITHIN GROUP (order by b nulls last)
    FROM (values (1,1),(1,4),(1,5),(3,1),(3,2)) v(a,b)
    GROUP BY ROLLUP (a) ORDER BY a;
  ]]>
  </dxl:Comment>
  <dxl:Thread Id="0">
    <dxl:OptimizerConfig>
      <dxl:EnumeratorConfig Id="0" PlanSamples="0" CostThreshold="0"/>
      <dxl:StatisticsConfig DampingFactorFilter="0.750000" DampingFactorJoin="0.000000" DampingFactorGroupBy="0.750000" MaxStatsBuckets="100"/>
      <dxl:CTEConfig CTEInliningCutoff="0"/>
      <dxl:WindowOids RowNumber="3100" Rank="3101"/>
      <dxl:CostModelConfig CostModelType="1" SegmentsForCosting="3">
        <dxl:CostParams>
          <dxl:CostParam Name="NLJFactor" Value="1024.000000" LowerBound="1023.500000" UpperBound="1024.500000"/>
        </dxl:CostParams>
      </dxl:CostModelConfig>
      <dxl:Hint JoinArityForAssociativityCommutativity="18" ArrayExpansionThreshold="100" JoinOrderDynamicProgThreshold="10" BroadcastThreshold="100000" EnforceConstraintsOnDML="false" PushGroupByBelowSetopThreshold="10" XformBindThreshold="0"/>
      <dxl:TraceFlags Value="102001,102002,102003,102043,102074,102120,102144,103001,103003,103014,103022,103026,103027,103029,103033,103038,103040,104002,104003,104004,104005,105000,106000"/>
    </dxl:OptimizerConfig>
    <dxl:Metadata SystemIds="0.GPDB">
      <dxl:Type Mdid="0.16.1.0" Name="bool" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="1" PassByValue="true">
        <dxl:DistrOpfamily Mdid="0.2222.1.0"/>
        <dxl:LegacyDistrOpfamily Mdid="0.7124.1.0"/>
        <dxl:EqualityOp Mdid="0.91.1.0"/>
        <dxl:InequalityOp Mdid="0.85.1.0"/>
        <dxl:LessThanOp Mdid="0.58.1.0"/>
        <dxl:LessThanEqualsOp Mdid="0.1694.1.0"/>
        <dxl:GreaterThanOp Mdid="0.59.1.0"/>
        <dxl:GreaterThanEqualsOp Mdid="0.1695.1.0"/>
        <dxl:ComparisonOp Mdid="0.1693.1.0"/>
        <dxl:ArrayType Mdid="0.1000.1.0"/>
        <dxl:MinAgg Mdid="0.0.0.0"/>
        <dxl:MaxAgg Mdid="0.0.0.0"/>
        <dxl:AvgAgg Mdid="0.0.0.0"/>
        <dxl:SumAgg Mdid="0.0.0.0"/>
        <dxl:CountAgg Mdid="0.2147.1.0"/>
      </dxl:Type>
      <dxl:GPDBAgg Mdid="0.3986.1.0" Name="rank" IsOrdered="true" IsSplittable="false" HashAggCapable="false">
        <dxl:ResultType Mdid="0.20.1.0"/>
        <dxl:IntermediateResultType Mdid="0.17.1.0"/>
      </dxl:GPDBAgg>
      <dxl:Type Mdid="0.20.1.0" Name="Int8" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="8" PassByValue="true">
        <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
        <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
        <dxl:EqualityOp Mdid="0.410.1.0"/>
        <dxl:InequalityOp Mdid="0.411.1.0"/>
        <dxl:LessThanOp Mdid="0.412.1.0"/>
        <dxl:LessThanEqualsOp Mdid="0.414.1.0"/>
        <dxl:GreaterThanOp Mdid="0.413.1.0"/>
        <dxl:GreaterThanEqualsOp Mdid="0.415.1.0"/>
        <dxl:ComparisonOp Mdid="0.351.1.0"/>
        <dxl:ArrayType Mdid="0.1016.1.0"/>
        <dxl:MinAgg Mdid="0.2131.1.0"/>
        <dxl:MaxAgg Mdid="0.2115.1.0"/>
        <dxl:AvgAgg Mdid="0.2100.1.0"/>
        <dxl:SumAgg Mdid="0.2107.1.0"/>
        <dxl:CountAgg Mdid="0.2147.1.0"/>
      </dxl:Type>
      <dxl:Type Mdid="0.23.1.0" Name="int4" IsRedistributable="true" IsHashable="true" IsMergeJoinable="true" IsComposite="false" IsTextRelated="false" IsFixedLength="true" Length="4" PassByValue="true">
        <dxl:DistrOpfamily Mdid="0.1977.1.0"/>
        <dxl:LegacyDistrOpfamily Mdid="0.7100.1.0"/>
        <dxl:EqualityOp Mdid="0.96.1.0"/>
        <dxl:InequalityOp Mdid="0.518.1.0"/>
        <dxl:LessThanOp Mdid="0.97.1.0"/>
        <dxl:LessThanEqualsOp Mdid="0.523.1.0"/>
        <dxl:GreaterThanOp Mdid="0.521.1.0"/>
        <dxl:GreaterThanEqualsOp Mdid="0.525.1.0"/>
        <dxl:ComparisonOp Mdid="0.351.1.0"/>
        <dxl:ArrayType Mdid="0.1007.1.0"/>
        <dxl:MinAgg Mdid="0.2132.1.0"/>
        <dxl:MaxAgg Mdid="0.2116.1.0"/>
        <dxl:AvgAgg Mdid="0.2101.1.0"/>
        <dxl:SumAgg Mdid="0.2108.1.0"/>
        <dxl:CountAgg Mdid="0.2147.1.0"/>
      </dxl:Type>
      <dxl:GPDBScalarOp Mdid="0.97.1.0" Name="&lt;" ComparisonType="LT" ReturnsNullOnNullInput="true" IsNDVPreserving="false">
        <dxl:LeftType Mdid="0.23.1.0"/>
        <dxl:RightType Mdid="0.23.1.0"/>
        <dxl:ResultType Mdid="0.16.1.0"/>
        <dxl:OpFunc Mdid="0.66.1.0"/>
        <dxl:Commutator Mdid="0.521.1.0"/>
        <dxl:InverseOp Mdid="0.525.1.0"/>
        <dxl:Opfamilies>
          <dxl:Opfamily Mdid="0.1976.1.0"/>
          <dxl:Opfamily Mdid="0.4054.1.0"/>
          <dxl:Opfamily Mdid="0.10009.1.0"/>
        </dxl:Opfamilies>
      </dxl:GPDBScalarOp>
    </dxl:Metadata>
    <dxl:Query>
      <dxl:OutputColumns>
        <dxl:Ident ColId="17" ColName="a" TypeMdid="0.23.1.0"/>
        <dxl:Ident ColId="16" ColName="rank" TypeMdid="0.20.1.0"/>
      </dxl:OutputColumns>
      <dxl:CTEList>
        <dxl:LogicalCTEProducer CTEId="1" Columns="1,2">
          <dxl:LogicalConstTable>
            <dxl:Columns>
              <dxl:Column ColId="1" Attno="1" ColName="column1" TypeMdid="0.23.1.0"/>
              <dxl:Column ColId="2" Attno="2" ColName="column2" TypeMdid="0.23.1.0"/>
            </dxl:Columns>
            <dxl:ConstTuple>
              <dxl:Datum TypeMdid="0.23.1.0" Value="1"/>
              <dxl:Datum TypeMdid="0.23.1.0" Value="1"/>
            </dxl:ConstTuple>
            <dxl:ConstTuple>
              <dxl:Datum TypeMdid="0.23.1.0" Value="1"/>
              <dxl:Datum TypeMdid="0.23.1.0" Value="4"/>
            </dxl:ConstTuple>
            <dxl:ConstTuple>
              <dxl:Datum TypeMdid="0.23.1.0" Value="1"/>
              <dxl:Datum TypeMdid="0.23.1.0" Value="5"/>
            </dxl:ConstTuple>
            <dxl:ConstTuple>
              <dxl:Datum TypeMdid="0.23.1.0" Value="3"/>
              <dxl:Datum TypeMdid="0.23.1.0" Value="1"/>
            </dxl:ConstTuple>
            <dxl:ConstTuple>
              <dxl:Datum TypeMdid="0.23.1.0" Value="3"/>
              <dxl:Datum TypeMdid="0.23.1.0" Value="2"/>
            </dxl:ConstTuple>
          </dxl:LogicalConstTable>
        </dxl:LogicalCTEProducer>
      </dxl:CTEList>
      <dxl:LogicalLimit>
        <dxl:SortingColumnList>
          <dxl:SortingColumn ColId="17" SortOperatorMdid="0.97.1.0" SortOperatorName="&lt;" SortNullsFirst="false"/>
        </dxl:SortingColumnList>
        <dxl:LimitCount/>
        <dxl:LimitOffset/>
        <dxl:LogicalCTEAnchor CTEId="1">
          <dxl:UnionAll InputColumns="17,16;11,13" CastAcrossInputs="false">
            <dxl:Columns>
              <dxl:Column ColId="17" Attno="1" ColName="a" TypeMdid="0.23.1.0"/>
              <dxl:Column ColId="16" Attno="2" ColName="rank" TypeMdid="0.20.1.0"/>
            </dxl:Columns>
            <dxl:LogicalProject>
              <dxl:ProjList>
                <dxl:ProjElem ColId="17" Alias="a">
                  <dxl:ConstValue TypeMdid="0.23.1.0" IsNull="true"/>
                </dxl:ProjElem>
              </dxl:ProjList>
              <dxl:LogicalGroupBy>
                <dxl:GroupingColumns/>
                <dxl:ProjList>
                  <dxl:ProjElem ColId="16" Alias="rank">
                    <dxl:AggFunc AggMdid="0.3986.1.0" AggDistinct="false" AggStage="Normal" AggKind="h" >
                      <dxl:ValuesList ParamType="aggargs">
                        <dxl:Ident ColId="15" ColName="column2" TypeMdid="0.23.1.0"/>
                      </dxl:ValuesList>
                      <dxl:ValuesList ParamType="aggdirectargs"/>
                      <dxl:ValuesList ParamType="aggorder">
                        <dxl:SortGroupClause Index="0" EqualityOp="96" SortOperatorMdid="97" SortNullsFirst="false" IsHashable="true"/>
                      </dxl:ValuesList>
                      <dxl:ValuesList ParamType="aggdistinct"/>
                    </dxl:AggFunc>
                  </dxl:ProjElem>
                </dxl:ProjList>
                <dxl:LogicalCTEConsumer CTEId="1" Columns="14,15"/>
              </dxl:LogicalGroupBy>
            </dxl:LogicalProject>
            <dxl:LogicalGroupBy>
              <dxl:GroupingColumns>
                <dxl:GroupingColumn ColId="11"/>
              </dxl:GroupingColumns>
              <dxl:ProjList>
                <dxl:ProjElem ColId="13" Alias="rank">
                  <dxl:AggFunc AggMdid="0.3986.1.0" AggDistinct="false" AggStage="Normal" AggKind="h" >
                    <dxl:ValuesList ParamType="aggargs">
                      <dxl:Ident ColId="12" ColName="column2" TypeMdid="0.23.1.0"/>
                    </dxl:ValuesList>
                    <dxl:ValuesList ParamType="aggdirectargs">
                      <dxl:Ident ColId="11" ColName="column1" TypeMdid="0.23.1.0"/>
                    </dxl:ValuesList>
                    <dxl:ValuesList ParamType="aggorder">
                      <dxl:SortGroupClause Index="0" EqualityOp="96" SortOperatorMdid="97" SortNullsFirst="false" IsHashable="true"/>
                    </dxl:ValuesList>
                    <dxl:ValuesList ParamType="aggdistinct"/>
                  </dxl:AggFunc>
                </dxl:ProjElem>
              </dxl:ProjList>
              <dxl:LogicalCTEConsumer CTEId="1" Columns="11,12"/>
            </dxl:LogicalGroupBy>
          </dxl:UnionAll>
        </dxl:LogicalCTEAnchor>
      </dxl:LogicalLimit>
    </dxl:Query>
    <dxl:Plan Id="0" SpaceSize="2">
      <dxl:Sort SortDiscardDuplicates="false">
        <dxl:Properties>
          <dxl:Cost StartupCost="0" TotalCost="862.002003" Rows="6.000000" Width="12"/>
        </dxl:Properties>
        <dxl:ProjList>
          <dxl:ProjElem ColId="5" Alias="a">
            <dxl:Ident ColId="5" ColName="a" TypeMdid="0.23.1.0"/>
          </dxl:ProjElem>
          <dxl:ProjElem ColId="4" Alias="rank">
            <dxl:Ident ColId="4" ColName="rank" TypeMdid="0.20.1.0"/>
          </dxl:ProjElem>
        </dxl:ProjList>
        <dxl:Filter/>
        <dxl:SortingColumnList>
          <dxl:SortingColumn ColId="5" SortOperatorMdid="0.97.1.0" SortOperatorName="&lt;" SortNullsFirst="false"/>
        </dxl:SortingColumnList>
        <dxl:LimitCount/>
        <dxl:LimitOffset/>
        <dxl:Sequence>
          <dxl:Properties>
            <dxl:Cost StartupCost="0" TotalCost="862.000948" Rows="6.000000" Width="12"/>
          </dxl:Properties>
          <dxl:ProjList>
            <dxl:ProjElem ColId="5" Alias="a">
              <dxl:Ident ColId="5" ColName="a" TypeMdid="0.23.1.0"/>
            </dxl:ProjElem>
            <dxl:ProjElem ColId="4" Alias="rank">
              <dxl:Ident ColId="4" ColName="rank" TypeMdid="0.20.1.0"/>
            </dxl:ProjElem>
          </dxl:ProjList>
          <dxl:CTEProducer CTEId="0" Columns="0,1">
            <dxl:Properties>
              <dxl:Cost StartupCost="0" TotalCost="0.000045" Rows="5.000000" Width="1"/>
            </dxl:Properties>
            <dxl:ProjList>
              <dxl:ProjElem ColId="0" Alias="column1">
                <dxl:Ident ColId="0" ColName="column1" TypeMdid="0.23.1.0"/>
              </dxl:ProjElem>
              <dxl:ProjElem ColId="1" Alias="column2">
                <dxl:Ident ColId="1" ColName="column2" TypeMdid="0.23.1.0"/>
              </dxl:ProjElem>
            </dxl:ProjList>
            <dxl:Values>
              <dxl:Properties>
                <dxl:Cost StartupCost="0" TotalCost="0.000040" Rows="5.000000" Width="8"/>
              </dxl:Properties>
              <dxl:ProjList>
                <dxl:ProjElem ColId="0" Alias="column1">
                  <dxl:Ident ColId="0" ColName="column1" TypeMdid="0.23.1.0"/>
                </dxl:ProjElem>
                <dxl:ProjElem ColId="1" Alias="column2">
                  <dxl:Ident ColId="1" ColName="column2" TypeMdid="0.23.1.0"/>
                </dxl:ProjElem>
              </dxl:ProjList>
              <dxl:ValuesList>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="1"/>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="1"/>
              </dxl:ValuesList>
              <dxl:ValuesList>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="1"/>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="4"/>
              </dxl:ValuesList>
              <dxl:ValuesList>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="1"/>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="5"/>
              </dxl:ValuesList>
              <dxl:ValuesList>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="3"/>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="1"/>
              </dxl:ValuesList>
              <dxl:ValuesList>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="3"/>
                <dxl:ConstValue TypeMdid="0.23.1.0" Value="2"/>
              </dxl:ValuesList>
            </dxl:Values>
          </dxl:CTEProducer>
          <dxl:Append IsTarget="false" IsZapped="false">
            <dxl:Properties>
              <dxl:Cost StartupCost="0" TotalCost="862.000831" Rows="6.000000" Width="12"/>
            </dxl:Properties>
            <dxl:ProjList>
              <dxl:ProjElem ColId="5" Alias="a">
                <dxl:Ident ColId="5" ColName="a" TypeMdid="0.23.1.0"/>
              </dxl:ProjElem>
              <dxl:ProjElem ColId="4" Alias="rank">
                <dxl:Ident ColId="4" ColName="rank" TypeMdid="0.20.1.0"/>
              </dxl:ProjElem>
            </dxl:ProjList>
            <dxl:Filter/>
            <dxl:Result>
              <dxl:Properties>
                <dxl:Cost StartupCost="0" TotalCost="431.000062" Rows="1.000000" Width="12"/>
              </dxl:Properties>
              <dxl:ProjList>
                <dxl:ProjElem ColId="5" Alias="a">
                  <dxl:ConstValue TypeMdid="0.23.1.0" IsNull="true"/>
                </dxl:ProjElem>
                <dxl:ProjElem ColId="4" Alias="rank">
                  <dxl:Ident ColId="4" ColName="rank" TypeMdid="0.20.1.0"/>
                </dxl:ProjElem>
              </dxl:ProjList>
              <dxl:Filter/>
              <dxl:OneTimeFilter/>
              <dxl:Aggregate AggregationStrategy="Plain" StreamSafe="false">
                <dxl:Properties>
                  <dxl:Cost StartupCost="0" TotalCost="431.000050" Rows="1.000000" Width="8"/>
                </dxl:Properties>
                <dxl:GroupingColumns/>
                <dxl:ProjList>
                  <dxl:ProjElem ColId="4" Alias="rank">
                    <dxl:AggFunc AggMdid="0.3986.1.0" AggDistinct="false" AggStage="Normal" AggKind="h" >
                      <dxl:ValuesList ParamType="aggargs">
                        <dxl:Ident ColId="3" ColName="column2" TypeMdid="0.23.1.0"/>
                      </dxl:ValuesList>
                      <dxl:ValuesList ParamType="aggdirectargs"/>
                      <dxl:ValuesList ParamType="aggorder">
                        <dxl:SortGroupClause Index="0" EqualityOp="96" SortOperatorMdid="97" SortNullsFirst="false" IsHashable="true"/>
                      </dxl:ValuesList>
                      <dxl:ValuesList ParamType="aggdistinct"/>
                    </dxl:AggFunc>
                  </dxl:ProjElem>
                </dxl:ProjList>
                <dxl:Filter/>
                <dxl:CTEConsumer CTEId="0" Columns="2,3">
                  <dxl:Properties>
                    <dxl:Cost StartupCost="0" TotalCost="431.000048" Rows="5.000000" Width="4"/>
                  </dxl:Properties>
                  <dxl:ProjList>
                    <dxl:ProjElem ColId="2" Alias="column1">
                      <dxl:Ident ColId="2" ColName="column1" TypeMdid="0.23.1.0"/>
                    </dxl:ProjElem>
                    <dxl:ProjElem ColId="3" Alias="column2">
                      <dxl:Ident ColId="3" ColName="column2" TypeMdid="0.23.1.0"/>
                    </dxl:ProjElem>
                  </dxl:ProjList>
                </dxl:CTEConsumer>
              </dxl:Aggregate>
            </dxl:Result>
            <dxl:Aggregate AggregationStrategy="Sorted" StreamSafe="false">
              <dxl:Properties>
                <dxl:Cost StartupCost="0" TotalCost="431.000697" Rows="5.000000" Width="12"/>
              </dxl:Properties>
              <dxl:GroupingColumns>
                <dxl:GroupingColumn ColId="6"/>
              </dxl:GroupingColumns>
              <dxl:ProjList>
                <dxl:ProjElem ColId="6" Alias="column1">
                  <dxl:Ident ColId="6" ColName="column1" TypeMdid="0.23.1.0"/>
                </dxl:ProjElem>
                <dxl:ProjElem ColId="8" Alias="rank">
                  <dxl:AggFunc AggMdid="0.3986.1.0" AggDistinct="false" AggStage="Normal" AggKind="h" >
                    <dxl:ValuesList ParamType="aggargs">
                      <dxl:Ident ColId="7" ColName="column2" TypeMdid="0.23.1.0"/>
                    </dxl:ValuesList>
                    <dxl:ValuesList ParamType="aggdirectargs">
                      <dxl:Ident ColId="6" ColName="column1" TypeMdid="0.23.1.0"/>
                    </dxl:ValuesList>
                    <dxl:ValuesList ParamType="aggorder">
                      <dxl:SortGroupClause Index="0" EqualityOp="96" SortOperatorMdid="97" SortNullsFirst="false" IsHashable="true"/>
                    </dxl:ValuesList>
                    <dxl:ValuesList ParamType="aggdistinct"/>
                  </dxl:AggFunc>
                </dxl:ProjElem>
              </dxl:ProjList>
              <dxl:Filter/>
              <dxl:Sort SortDiscardDuplicates="false">
                <dxl:Properties>
                  <dxl:Cost StartupCost="0" TotalCost="431.000623" Rows="5.000000" Width="8"/>
                </dxl:Properties>
                <dxl:ProjList>
                  <dxl:ProjElem ColId="6" Alias="column1">
                    <dxl:Ident ColId="6" ColName="column1" TypeMdid="0.23.1.0"/>
                  </dxl:ProjElem>
                  <dxl:ProjElem ColId="7" Alias="column2">
                    <dxl:Ident ColId="7" ColName="column2" TypeMdid="0.23.1.0"/>
                  </dxl:ProjElem>
                </dxl:ProjList>
                <dxl:Filter/>
                <dxl:SortingColumnList>
                  <dxl:SortingColumn ColId="6" SortOperatorMdid="0.97.1.0" SortOperatorName="&lt;" SortNullsFirst="false"/>
                </dxl:SortingColumnList>
                <dxl:LimitCount/>
                <dxl:LimitOffset/>
                <dxl:CTEConsumer CTEId="0" Columns="6,7">
                  <dxl:Properties>
                    <dxl:Cost StartupCost="0" TotalCost="431.000096" Rows="5.000000" Width="8"/>
                  </dxl:Properties>
                  <dxl:ProjList>
                    <dxl:ProjElem ColId="6" Alias="column1">
                      <dxl:Ident ColId="6" ColName="column1" TypeMdid="0.23.1.0"/>
                    </dxl:ProjElem>
                    <dxl:ProjElem ColId="7" Alias="column2">
                      <dxl:Ident ColId="7" ColName="column2" TypeMdid="0.23.1.0"/>
                    </dxl:ProjElem>
                  </dxl:ProjList>
                </dxl:CTEConsumer>
              </dxl:Sort>
            </dxl:Aggregate>
          </dxl:Append>
        </dxl:Sequence>
      </dxl:Sort>
    </dxl:Plan>
  </dxl:Thread>
</dxl:DXLMessage>
